package com.gym.code.generator.impl.degelate.method;

import static com.gym.code.generator.Contants.$tab;
import static com.gym.code.generator.utils.GenerateFileUtils.generateChar;

import java.util.ArrayList;
import java.util.List;

import com.gym.code.generator.model.mapping.field.FieldGenerateModel;

/**
 * 
 * @author xinchun.wang 
   @email: 532002108@qq.com
 * @createTime 2015-5-23 下午8:45:41
 */
public class GetMethodGenerateHandlerImpl implements
		BeanMethodGenerateHandler {

    private GetMethodGenerateHandlerImpl(){}
	
	private static GetMethodGenerateHandlerImpl instance = new GetMethodGenerateHandlerImpl();
	
	public static GetMethodGenerateHandlerImpl getInstance(){
		return instance;
	}
	
	@Override
	public List<String> generateMethod(FieldGenerateModel model) {
		List<String> result = new ArrayList<String>();
		result.add("");
		result.add(generateChar(1,$tab) + "public " +
				(model.getValueType().isJdkDefine() ? model.getValueType().getName(): model.getValueType().getJavaName() )
		+ " get" + model.getPropertyNameByFirstLetterUpper() + "() {");
		result.add(generateChar(2,$tab) + "return this." + model.getPropertyName() + ";");
		result.add(generateChar(1,$tab)+ "}");
		return result;
	}

}
